package com.handpay.nocardpay.baselibrary.threadmanager;


import android.util.Log;

/**
 * @author sxshi
 */
public class ThreadPoolFactory {
    private static final String TAG = "ThreadPoolFactory";
    static ThreadPoolProxy mNormalPool;
    static ThreadPoolProxy mDownLoadPool;

    /**
     * 得到一个普通的线程池
     *
     * @return
     */
    public static ThreadPoolProxy getNormalPool() {
//        Log.d(TAG, "*************线程池工厂创建普通线程池*************");
        if (mNormalPool == null) {
            synchronized (ThreadPoolFactory.class) {
                if (mNormalPool == null) {
                    mNormalPool = new ThreadPoolProxy(CustomThreadPoolExecutor.newThreadPoolExecutor());
                }
            }
        }
        return mNormalPool;
    }

    /**
     * 得到一个下载的线程池
     *
     * @return
     */
    public static ThreadPoolProxy getDownLoadPool() {
//        Log.d(TAG, "*************线程池工厂创建下载线程池*************");
        if (mDownLoadPool == null) {
            synchronized (ThreadPoolFactory.class) {
                if (mDownLoadPool == null) {
                    mDownLoadPool = new ThreadPoolProxy(CustomThreadPoolExecutor.newThreadPoolExecutor());
                }
            }
        }
        return mDownLoadPool;
    }
}
